package BinaryTree;

import javax.swing.event.TreeModelListener;
import java.util.Stack;

public class Test {

    public static void main03(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        int[] a={3,9,20,15,7};
        int[] b={9,3,15,20,7};
        binaryTree.buildTree(a,b);
        System.out.println();

    }



    public static void main02(String[] args) {
/*        BinaryTree binaryTree=new BinaryTree();
        String s="ABC##DE#G##F###";
        binaryTree.creatTree(s);*/

        BinaryTree binaryTree=new BinaryTree();
        binaryTree.create();
        binaryTree.levelOrder(binaryTree.root);

        System.out.println(binaryTree.isCompleteTree(binaryTree.root));
    }






    public static void main(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree binaryTree2=new BinaryTree();
        BinaryTree binaryTree3=new BinaryTree();
        binaryTree.create();
        binaryTree2.create2();
        binaryTree3.create3();

        System.out.println("+++++++++");

/*        binaryTree.preOrder(binaryTree.root);
        System.out.println();
        binaryTree.inOrder(binaryTree.root);
        System.out.println();
        binaryTree.postOrder(binaryTree.root);
        System.out.println();*/

        System.out.println(binaryTree.preorderTraversal(binaryTree.root));
        binaryTree.preorderNor(binaryTree.root);
        System.out.println();
        System.out.println(binaryTree.inorderTraversal(binaryTree.root));
        binaryTree.inorderNor(binaryTree.root);
        System.out.println();
        System.out.println(binaryTree.postorderTraversal(binaryTree.root));
        binaryTree.postorderNor(binaryTree.root);
        System.out.println();

/*        System.out.println("树中节点数："+binaryTree.size(binaryTree.root));
        System.out.println("叶子节点数："+binaryTree.getLeafNodeCount(binaryTree.root));
        System.out.println("第3层节点数："+binaryTree.getKLevelNodeCount(binaryTree.root,3));
        System.out.println("层数："+binaryTree.getHeight(binaryTree.root));

        System.out.println("找E："+binaryTree.find(binaryTree.root,"E"));
        System.out.println(binaryTree.isSubtree(binaryTree.root, binaryTree2.root));

        binaryTree.invertTree(binaryTree.root);

        System.out.println(binaryTree3.isBalanced(binaryTree3.root));*/
    }
}
